<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function Star(uname, age) {
            this.name = uname;
            this.age = age;
            // console.log(this);
        }
        const ldh = new Star('zxy', 17)
        Star.prototype.sex = function () {
            console.log('男');
        }
        // console.log(ldh);
        // console.log(Star);
        Star.prototype.sing = function () {
            console.log('17岁');
        }
        // ldh.sing();
        const zxy = new Star('ldh', 18)
        // zxy.sex();
        // console.log(ldh);

        Array.prototype.he = function () {
            let num = 0;
            for (let i = 0; i < this.length; i++) {
                num += this[i];
            }
            return num;
        }
        const arr = [3, 4, 5]
        // console.log(arr.he());
        // console.log(Array.prototype);
        function he() {
            let num = 0;
            for (let i = 0; i < this.length; i++) {
                num += this[i];
            }
            console.log(num);;
        }
        // function kao() {
        //     console.log(this);

        //     this.num: he()
        // }
        kao.call(arr, arr)

    </script>

</body>

</html>